using Boo.Lang;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class MenuButtons3D : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024q_0024411 : GenericGenerator<WaitForSeconds>
	{
		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024();
		}
	}

	public AudioClip clip;

	public Color pressed;

	public Color unpressed;

	public string loadcareer;

	public string loadmatch;

	public string loadoptions;

	public string loadworkshop;

	public string loadmarket;

	public Collider career;

	public Collider credits;

	public Collider match;

	public Collider options;

	public Collider quit;

	public Collider workshop;

	public Collider market;

	public Collider achievements;

	public int state;

	public Camera mainCamera;

	public GameObject Credits;

	public GameObject hideads;

	public Vector2 pos;

	public string nam;

	public GameObject achievementsOpener;

	public MenuButtons3D()
	{
		loadcareer = string.Empty;
		loadmatch = string.Empty;
		loadoptions = string.Empty;
		loadworkshop = string.Empty;
		loadmarket = string.Empty;
		nam = string.Empty;
	}

	public void Start()
	{
		GameObject.Find("Tops").transform.position = GameObject.Find("Tops").transform.position + new Vector3(7f, 2f, 7f);
		LeanTween.move(GameObject.Find("Tops"), new Vector3(1.61f, 0.6f, -6.49f), 0.8f).setEase(LeanTweenType.easeOutCubic);
		StateManager.state = State.Neutral;
		PlayerPrefs.Save();
		if (PlayerPrefs.GetInt("tmp") == 7)
		{
			UnityEngine.Object.Instantiate(hideads);
		}
		if (PlayerPrefs.GetInt("32Bit") == 1)
		{
			Handheld.use32BitDisplayBuffer = true;
		}
		else
		{
			Handheld.use32BitDisplayBuffer = false;
		}
	}

	public void Update()
	{
		if (StateManager.state == State.IAP || StateManager.state == State.ChangeLog || StateManager.state == State.HelpScreen)
		{
			return;
		}
		if (Input.GetMouseButtonDown(0))
		{
			pos = UnityEngine.Input.mousePosition;
			RaycastHit hitInfo = default(RaycastHit);
			if (Physics.Raycast(mainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition), out hitInfo, 100f))
			{
				nam = hitInfo.collider.name;
				if (nam == "Career")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					career.GetComponent<Renderer>().material.color = pressed;
					career.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Credits")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					credits.GetComponent<Renderer>().material.color = pressed;
					credits.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Match")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					match.GetComponent<Renderer>().material.color = pressed;
					match.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Options")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					options.GetComponent<Renderer>().material.color = pressed;
					options.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Quit")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					quit.GetComponent<Renderer>().material.color = pressed;
					quit.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Workshop")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					workshop.GetComponent<Renderer>().material.color = pressed;
					workshop.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Market")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					market.GetComponent<Renderer>().material.color = pressed;
					market.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
				else if (nam == "Achievements")
				{
					AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
					achievements.GetComponent<Renderer>().material.color = pressed;
					achievements.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				}
			}
		}
		if (Input.GetMouseButtonUp(0))
		{
			check();
			st();
		}
	}

	public void check()
	{
		Vector3 mousePosition = UnityEngine.Input.mousePosition;
		if (mousePosition.x / pos.x <= 0.95f)
		{
			return;
		}
		Vector3 mousePosition2 = UnityEngine.Input.mousePosition;
		if (mousePosition2.x / pos.x >= 1.05f)
		{
			return;
		}
		Vector3 mousePosition3 = UnityEngine.Input.mousePosition;
		if (mousePosition3.y / pos.y <= 0.95f)
		{
			return;
		}
		Vector3 mousePosition4 = UnityEngine.Input.mousePosition;
		if (mousePosition4.y / pos.y >= 1.05f)
		{
			return;
		}
		if (nam == "Career")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene(loadcareer);
		}
		else if (nam == "Credits")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			Credits.SetActiveRecursively(state: true);
		}
		else if (nam == "Match")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene(loadmatch);
		}
		else if (nam == "Options")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene(loadoptions);
		}
		else if (nam == "Quit")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			StartCoroutine(q());
		}
		else if (nam == "Workshop")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene(loadworkshop);
		}
		else if (nam == "Market")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene(loadmarket);
		}
		else if (nam == "Achievements")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			if (Social.localUser.authenticated)
			{
				Social.ShowAchievementsUI();
			}
			else
			{
				UnityEngine.Object.Instantiate(achievementsOpener);
			}
		}
		else if (nam == "Tops")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.SceneManagement.SceneManager.LoadScene("workshop");
		}
	}

	public IEnumerator q()
	{
		return new _0024q_0024411().GetEnumerator();
	}

	public void st()
	{
		career.GetComponent<Renderer>().material.color = unpressed;
		credits.GetComponent<Renderer>().material.color = unpressed;
		match.GetComponent<Renderer>().material.color = unpressed;
		options.GetComponent<Renderer>().material.color = unpressed;
		quit.GetComponent<Renderer>().material.color = unpressed;
		workshop.GetComponent<Renderer>().material.color = unpressed;
		market.GetComponent<Renderer>().material.color = unpressed;
		achievements.GetComponent<Renderer>().material.color = unpressed;
		career.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		credits.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		match.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		options.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		quit.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		workshop.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		market.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		achievements.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		nam = null;
	}

	public void Main()
	{
	}
}
